<div class="dialog">
    <table>
        <tbody>
        <input type="hidden" name="id" value="${staffGroupInstance?.id}" />
        <tr class="prop">
            <td valign="top" class="name">
                <label for="name">Name:</label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: staffGroupInstance, field: 'name', 'errors')}">
                <input type="text" id="name" name="name" value="${fieldValue(bean: staffGroupInstance, field: 'name')}"/>
            </td>
        </tr>

        <tr class="prop">
            <td valign="top" class="name">
                <label for="role">Role:</label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: staffGroupInstance, field: 'role', 'errors')}">
                %{--<input type="text" id="role" name="role" value="${fieldValue(bean:staffGroupInstance,field:'role')}"/>--}%
                <g:select value="${staffGroupInstance.role}" from="[Constants.ROLE_SHOP_ASSISTANT, Constants.ROLE_MANAGER]" name="role"/>
            </td>
        </tr>

        <g:if test="${staffGroupInstance.id != null}">
            <tr class="prop">
                <td valign="top" class="name">
                    <label for="staffs">Staffs:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffGroupInstance, field: 'staffs', 'errors')}">

                    <ul>
                        <g:each var="s" in="${staffGroupInstance?.staffs?}">
                            <li><g:link controller="staff" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
                        </g:each>
                    </ul>
                    <g:link controller="staff" params="['staffGroup.id':staffGroupInstance?.id]" action="create">Add Staff</g:link>

                </td>
            </tr>
        </g:if>

        </tbody>
    </table>
</div>